home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pru_treasuredoor.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  164 lines

  1. # Jones 3D Cog Script
  2. #
  3. # PRU_treasuredoor.cog
  4. #
  5. # Open treasure door with key.
  6. #
  7. # (GGJ)
  8. #
  9. # (C) 1998 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11. symbols
  12.  
  13. message     activated
  14. message        startup
  15. message        arrived
  16.  
  17. thing        player    local
  18. thing        actor
  19. thing        door0
  20. thing        junctionCam0
  21. thing        junctionTarget0
  22. thing        junctionTarget1
  23. thing        junctionTarget2
  24. thing        key
  25. thing        junRevertCam
  26. thing        pitdoor
  27.         
  28. surface        lock
  29.  
  30. keyframe    unlock=in_activate_medium.key        local
  31.  
  32. sound        dialogue=inxj082.wav                local        #keyhole here...just need key
  33. sound        dialogue2=inxj077.wav                local
  34.  
  35. sound    startdoor=nub_stonedoor_start_c.wav    local
  36. sound    movedoor=teo_stonebar_slide_c.wav        local
  37. sound    stopdoor=nub_stonedoor_stop_c.wav        local
  38. sound    openwav=inxj108.wav                    local
  39. sound    keySnd=tem_monkeykey_unlock_c.wav        local
  40.  
  41. flex        moveSpeed=1.0                        local
  42. flex        tempRotVel                            local
  43.  
  44. float   speed=1.0                                local
  45.  
  46. int        talking=0                                local
  47. int        curCam                                    local
  48. int        move0channel                            local
  49. int        open=0                                    local
  50. int        tempCam                                    local
  51.  
  52. cog        hint
  53.         
  54. end
  55. #=================================================================================================
  56. code
  57. startup:
  58.     Sleep(0.01);    
  59.     player = GetLocalPlayerThing();
  60.     SetThingFlags(actor, 0x80000);
  61.     SetThingFlags(key, 0x80000);
  62.     return;
  63. #=================================================================================================
  64. activated:
  65.  
  66. PRINT("activated");
  67. if ((open) == 1) return;    
  68.     
  69. if ((GetSenderRef() == lock) && (GetCurItem(player) != 98) && (talking == 0))
  70. {
  71.     talking = 1;
  72.     Print("no key");
  73.     PlayVoice(player, dialogue, 1, 1);
  74.     Sleep(0.5);
  75.     talking = 0;
  76.  
  77. }
  78.  
  79. if ((GetSenderRef() == lock) && (GetCurItem(player) == 98))
  80. {
  81.     curCam = GetCurrentCamera();
  82.     StartCutscene(1);
  83.     open = 1;
  84.     
  85.     SetCameraLookInterp(2, 0);
  86.     SetCameraFocus(2, junctionCam0);
  87.     SetCameraSecondaryFocus(2, junctionTarget0);
  88.     SetCurrentCamera(2);
  89.     SetCameraFOV(60, 0, 0.0);
  90.     SetCameraLookInterp(2, 1);
  91.     
  92.     SetActorFlags(player, 0x200000);
  93.     StopThing(player);
  94.     PlayMode(player, 1, 0);
  95.     CopyPlayerHolsters(player, actor);
  96.     SetThingFlags(player, 0x80000);
  97.     ClearThingFlags(actor, 0x80000);
  98.     
  99.     PlayKey(actor, unlock, 4, 0x12, 0);
  100.     
  101.     Sleep(0.5);
  102.     ClearThingFlags(key, 0x80000);
  103.     SetThingLight(key, '0.8 0.8 0.8', 0.01, 0.01);
  104.     MoveToFrame(key, 1, 0.5);
  105.     PlaySoundThing(keySnd, key, .75, -1, -1, 0);
  106.  
  107.     Sleep(1.0);
  108.     #DestroyThing(key);
  109.     
  110.     #remove key from inventory
  111.     ChangeInv(player, 98, -1);
  112.  
  113.     
  114.     SetCameraFOV(90, 1, 2.0);
  115.     SetCameraSecondaryFocus(2, junctionTarget1);
  116.     Sleep(1.0);
  117.     
  118.     tempRotVel=GetThingMaxRotVel(actor);
  119.     SetThingMaxRotVel(actor, 200.0);
  120.     
  121.     
  122.     AISetLookThing(actor, junctionTarget2);
  123.     PlaySoundLocal(startdoor, 1.0, 0, 0x0000, 0);
  124.     move0channel = PlaySoundLocal(movedoor, 1.0, 0, 0x0001, 0);
  125.     MoveToFrame(door0, 1 - GetCurFrame(door0), moveSpeed);
  126.     MoveToFrame(junctionCam0, 1, 1.0);
  127.             
  128. }
  129. return;
  130.     
  131. arrived:    
  132. if (GetSenderRef() != door0) return;
  133.  
  134. StopSound(move0channel, 0.0);
  135.  
  136. PlayVoice(actor, openwav, 1, 0);
  137.  
  138. PlaySoundLocal(stopdoor, 1.0, 0, 0x0000, 1);
  139.  
  140. tempCam = GetThingPos(junRevertCam);
  141. SetCameraPosition(curCam, tempCam);
  142. SetCurrentCamera(curCam);
  143.  
  144. CopyOrientandPos(actor, player);
  145. SetThingMaxRotVel(actor, tempRotVel);
  146. SetThingFlags(actor, 0x80000);
  147. ClearThingFlags(player, 0x80000);
  148. ClearActorFlags(player, 0x200000);
  149. EndCutscene();
  150. SendMessage(hint, user4);
  151.  
  152. #close off door to 1st portion of level to prevent confused players from going back too far.
  153. if (GetDifficulty() < 5)
  154. {
  155.     MoveToFrame(pitDoor, 1, 1.0);
  156. }
  157.  
  158. SetCollideType(door0, 0);
  159.  
  160. return;
  161.  
  162.  
  163. end
  164.